package com.armani.mapper;

import com.armani.entity.User;
import com.armani.model.UserModel;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: 用户Mapper
 * @Package: com.armani.mapper
 * @ClassName: UserMapper
 * @Description: TODO
 * @Author: Roc
 * @Date: 2021/11/27 18:28
 * @Version: 1.0
 **/
public interface UserMapper {
    /**
     *
     * @param user
     * @param startRow
     * @param limit
     * @return
     */
    List<User> ListSearch(@Param(value = "level") Integer level,
                          @Param(value = "user")String user,

                          @Param(value = "startRow") Integer startRow,
                          @Param(value = "limit")  Integer limit);

    /**
     *
     * @param level
     * @param user
     * @return
     */
    Integer getCount(@Param(value = "level") Integer level,
                     @Param(value = "user")String user);


    /**
     * 添加
     * @param userName
     * @param user
     * @param password
     * @param phone
     * @param sex
     * @param cardId
     * @param birth
     * @param email
     * @param createtime
     * @param level
     * @param balance
     * @return
     */
    Integer insert(@Param(value = "userName") String userName,
                   @Param(value = "user")String user,
                   @Param(value = "password") String password,
                   @Param(value = "phone")String phone,
                   @Param(value = "sex") String sex,
                   @Param(value = "cardId")String cardId,
                   @Param(value = "birth") Date birth,
                   @Param(value = "email")String email,
                   @Param(value = "createtime")Date createtime,
                   @Param(value = "level")Integer level,
                   @Param(value = "balance") BigDecimal balance,
                   @Param(value = "zhuangtai") Integer zhuangtai);


    /**
     * 修改
     * @param userName
     * @param user
     * @param password
     * @param phone
     * @param sex
     * @param cardId
     * @param birth
     * @param email
     * @param createtime
     * @param level
     * @param balance
     * @param id
     * @return
     */
    Integer update(@Param(value = "userName") String userName,
                   @Param(value = "user")String user,
                   @Param(value = "password") String password,
                   @Param(value = "phone")String phone,
                   @Param(value = "sex") String sex,
                   @Param(value = "cardId")String cardId,
                   @Param(value = "birth") Date birth,
                   @Param(value = "email")String email,
                   @Param(value = "createtime")Date createtime,
                   @Param(value = "level")Integer level,
                   @Param(value = "balance") BigDecimal balance,
                   @Param(value = "zhuangtai") Integer zhuangtai,
                   @Param(value = "id") Integer id);

    /**
     * 删除
     * @param id
     * @return
     */
    Integer delete(@Param(value = "id")Integer id);

    /**
     * 修改用户状态
     * @param zhuangtai
     * @return
     */
    Integer ztupdate(@Param(value = "zhuangtai")String zhuangtai,
                     @Param(value = "id")Integer id);

    /**
     * 用户登录
     * @param userModel 参数（用户名、密码）
     * @return 当前用户的信息
     */
    User login(UserModel userModel);

    /**
     * 注册
     * @param userModel 参数（用户名、密码、生日等）
     * @return 影响行
     */
    Integer register(UserModel userModel);
}
